-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jobs: templating for email action #1326
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bpedersen2
reviewed
Aug 20, 2024
sbliven
approved these changes
Sep 6, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine with the understanding that the SMTP part is a stub. For instance, in the real thing the user/password should not come from jobConfig.json but from environmental variables. We will need a GraphQL implementation too for MS365 emails.
despadam
changed the title
Jobs: implement email action
Jobs: templating for email action
Sep 9, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation:
#1152
Description:
The email action is implemented so that it validates all relevant values provided in the configuration file, inside the constructor. When performing the action, the email body is read from a template file, the path for which is provided in the configuration. We then fill in the values in the template with the respective job-specific information.
Please note that this is a first and basic implementation of the email action, which acts as a proof of concept for the Jobs MVP. The mailer (i.e. SMTP) is not property set up, so in the end we never actually send the email. Instead, we only perform validation and templating, and print the result of what the email content would look like, in the console.
Changes:
jobConfig.example.json
: included configuration for the email action. It is possible that this is not the final schema, especially when it comes to providing the value forpassword
. TBD as it is dependent on how the mailer service is set up in the facility. Please note the assumption thatbodyTemplate
should be the path to the template file.job-template-simplified.html
is a minimal template example that requires only some basic job information. To be expanded.emailaction.ts
: based on previous changes in the Action class, all validation is performed inside the constructor. Setting upmailService
is commented out as we are currently not actually making the connection to the service. We open and read the file for which the path is provided inbodyTemplate
. We fill in the template with the job details. Only the necessary fields are exposed to the template viajobTemplateOptions
. In the end, instead of sending an actual email, we print the result in the console.jobs.controller.ts
: applied a fix in order to always correctly provide to the template a list ofdatasetIds
insidejobParams
.